package PTA3.ti26;

import java.util.Scanner;

/**
 * @author Lenovo
 */
class Circle{
    private int radius;
    public Circle(){
        this.radius=2;
        System.out.println("this is a constructor");
    }
    public Circle(int radius){
        this.radius=radius;
        if(radius<=0){
           this.radius=2;
        }
        System.out.println("this is a constructor with para");
    }

    public void setRadius(int radius) {
        this.radius = radius;
        if(radius<=0){
            this.radius=2;
        }
    }

    public int getRadius() {
        return radius;
    }
    public int gerArea(){
        return (int)(Math.PI*radius*radius);
    }
    public String toString(){
        return "Circle [radius=" + radius + "]";
    }
}
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        Circle c1=new Circle();
        System.out.println(c1);
        System.out.println("c1:area"+c1.gerArea());
        Circle c2=new Circle();
        System.out.println(c2);
        int radius2= scanner.nextInt();
        c2.setRadius(radius2);
        System.out.println(c2);
        System.out.println("c2:area"+c2.gerArea());
        int radius3 =scanner.nextInt();
        Circle c3=new Circle();
        c3.setRadius(radius3);
        System.out.println(c3);
        System.out.println("c3:area:"+c3.gerArea());
        scanner.close();
    }
}
